﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Currencies.aspx.cs" Inherits="ImgForecast.admin.Currencies" %>
<%@ Register assembly="obout_Grid_NET" namespace="Obout.Grid" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>
        Currencies</h1>
    <cc1:Grid ID="Grid1" runat="server" DataSourceID="SqlDataSource1"  CallbackMode="true"
        Serialize="true" AllowAddingRecords="true" AutoGenerateColumns="false">
                <Columns>
            <cc1:Column ID="Column1" DataField="CurrencyID" Visible="false" ReadOnly="true" HeaderText="Office ID"
                Width="100" runat="server" />
            <cc1:Column ID="Column2" DataField="Name" HeaderText="Name" Width="200" runat="server" />
            <cc1:Column ID="Column3" DataField="Abbreviation" HeaderText="Abbr" Width="100" runat="server" />
            <cc1:Column ID="Column5" DataField="ExchangeRateToUSD" HeaderText="Exchange Rate To USD" Width="200" runat="server" />
            <cc1:Column ID="Column4" HeaderText="Edit" AllowEdit="true" AllowDelete="true" Width="125" runat="server" />
        </Columns>
    </cc1:Grid>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
        DeleteCommand="DELETE FROM [Currencies] WHERE [CurrencyID] = @CurrencyID" 
        InsertCommand="INSERT INTO [Currencies] ([Name], [Abbreviation], [ExchangeRateToUSD]) VALUES (@Name, @Abbreviation, @ExchangeRateToUSD)" 
        SelectCommand="SELECT * FROM [Currencies] ORDER BY [Name]" 
        UpdateCommand="UPDATE [Currencies] SET [Name] = @Name, [Abbreviation] = @Abbreviation, [ExchangeRateToUSD] = @ExchangeRateToUSD WHERE [CurrencyID] = @CurrencyID">
        <DeleteParameters>
            <asp:Parameter Name="CurrencyID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="Abbreviation" Type="String" />
            <asp:Parameter Name="ExchangeRateToUSD" Type="Double" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="Abbreviation" Type="String" />
            <asp:Parameter Name="ExchangeRateToUSD" Type="Double" />
            <asp:Parameter Name="CurrencyID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>
